import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:求阶乘和
 * User: zjc
 * Date: 2022-04-27
 * Time: 20:59
 */
public class Project {
    public static int Fac(int a) {
        int fac = 1;
        for (int i = 1; i <= a; i++) {
            fac *= i;
        }
        return fac;
    }

    /**
     * 上面方法是求阶乘；
     * 下面的main函数是把各个阶乘加起来。
     * @param args
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int sum = 0;
        for (int i = 1; i <= n; i++) {
            sum += Fac(i);
        }
        System.out.println(sum);
    }
}
